﻿Imports Microsoft.Xna.Framework
Imports Microsoft.Xna.Framework.GamerServices

Public MustInherit Class Screen

#Region " Fields "
    Private mAmbientMood As String
    Private mGameManager As GameManager
#End Region ' Fields

#Region " Properties "

    ''' <summary>
    ''' Friendly (human readable) name for the screen
    ''' </summary>
    Public MustOverride ReadOnly Property ScreenName() As String

#End Region

    ''' <summary>
    ''' This is called after all updates but before any acutal drawing.
    ''' </summary>
    Public Overridable Sub UpdatePresentation(ByVal elapsedSeconds As Single)
    End Sub

    ''' <summary>
    ''' The manager that this object belongs to.
    ''' </summary>
    Public Property GameManager() As GameManager
        Get
            GameManager = mGameManager

        End Get
        Set(ByVal value As GameManager)
            mGameManager = value
        End Set
    End Property

#Region " Initialization "
    Public Sub New(ByVal GameManager As GameManager)
        mGameManager = GameManager
    End Sub

    Public Overridable Sub Initialize()
    End Sub

    Public Overridable Sub LoadContent()
    End Sub

    Public Overridable Sub UnloadContent()
    End Sub
#End Region

#Region " Update and Draw "

    ''' <summary>
    ''' Allows the game object to run logic.
    ''' </summary>
    Public Overridable Sub Update(ByVal elapsedSeconds As Single)
    End Sub

    '''<summary>
    ''' Allows the game object to handle user input.
    ''' </summary>
    Public Overridable Sub HandleInput(ByVal input As IGamePadInputManager)
    End Sub

    ''' <summary>
    ''' This is called when the screen should draw itself.
    ''' </summary>
    Public Overridable Sub Draw(ByVal elapsedSeconds As Single)
    End Sub


#End Region ' Update and Draw

#Region "Public Methods"

    Public Sub ExitScreen()
        'TODO could make this start a transition off?
        GameManager.RemoveScreen(Me)
    End Sub

    ''' <summary>
    ''' Plays sound effects
    ''' </summary>
    Public Sub PlaySound(ByVal friendlyName As String)
        GameManager.PlaySound(friendlyName)
    End Sub

    ''' <summary>
    ''' Friendly name of the Ambient Mood of the screen
    ''' </summary>
    Public Property AmbientMood() As String
        Get
            'TODO could redesign to allow more than one mood possible for a screen
            AmbientMood = mAmbientMood
        End Get
        Protected Set(ByVal value As String)
            mAmbientMood = value
        End Set
    End Property

#End Region

#Region " Notification "

    Public Sub ShowNotification(ByVal message As String)
        ShowNotification(message, 2.0F, 10.0F, 2.0F, NotificationPosition.TopLeft)
    End Sub

    Public Sub ShowNotification(ByVal message As String, ByVal fadeInTime As Single, ByVal onScreenTime As Single, ByVal fadeOutTime As Single, ByVal positionOnScreen As NotificationPosition)
        GameManager.ShowNotification(message, fadeInTime, onScreenTime, fadeInTime, positionOnScreen)
    End Sub

#End Region ' Notification

End Class